<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

</body>
<script>
  const obj1 = {
    name: "gh",
    age: '19',
    height: '180'
  }
  const obj2 = {
    name: "yz",
    age: '19',
    height: '160'
  }
  const a = 1
  // let name, age, height
  if (a) {
    var { name, age, height } = { ...obj1 }
  } else {
    var { name, age, height } = obj2
  }
  console.log(name, age, height);
</script>

</html>